package app.fugema.shop.main.order.adapter;

import com.base.common.utils.DensityUtil;
import com.base.common.utils.UIUtils;
import com.base.common.view.adapter.ada.GeneralRecyclerAdapter;
import com.base.common.view.adapter.connector.BaseItemMultiType;

import app.fugema.shop.R;
import app.fugema.shop.databinding.ShopingConfirmOrderItBinding;
import app.fugema.shop.main.order.model.CartItemProductModel;

public class ConfirmOrderGoodsAdapter extends GeneralRecyclerAdapter
{
    public ConfirmOrderGoodsAdapter()
    {
        init();
    }

    @Override
    public void initMultiItemType()
    {
        putMultiItemType(new BaseItemMultiType<CartItemProductModel, ShopingConfirmOrderItBinding>() {
            @Override
            public int getLayoutId()
            {
                return R.layout.shoping_confirm_order_it;
            }

            @Override
            public void onBindViewHolder(ShopingConfirmOrderItBinding binding, int position, CartItemProductModel bean)
            {
                super.onBindViewHolder(binding, position, bean);
                if (position == 1)
                {
                    //binding.clItemView.getDelegate().setCornerRadius_TL(DensityUtil.getDimens(R.dimen.dp_10));
                    //binding.clItemView.getDelegate().setCornerRadius_TR(DensityUtil.getDimens(R.dimen.dp_10));
                } else {
                    //binding.clItemView.getDelegate().setCornerRadius_TL(DensityUtil.getDimens(R.dimen.dp_0));
                    //binding.clItemView.getDelegate().setCornerRadius_TR(DensityUtil.getDimens(R.dimen.dp_0));
                }

                StringBuffer specSb = new StringBuffer();
                if(UIUtils.isNotEmpty( bean.getSize() ))
                {
                    specSb.append( bean.getSizeAlias() ).append(":").append(bean.getSize()).append(" ");
                }
                if(UIUtils.isNotEmpty( bean.getColor() ))
                {
                    specSb.append( bean.getColorAlias() ).append(":").append(bean.getColor()).append(" ");
                }
                if(UIUtils.isNotEmpty( bean.getVersion() ))
                {
                    specSb.append( bean.getVersionAlias() ).append(":").append(bean.getVersion());
                }
                binding.tvSpecDetail.setText( specSb.toString() );
            }
        });
    }
}
